package cn.lili.controller.wechat;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.payment.entity.dos.WechatBill;
import cn.lili.modules.payment.entity.dto.WechatBillSearchParams;
import cn.lili.modules.payment.service.WechatBillService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * 管理端,商家结算单接口
 *
 * @author Chopper
 * @since 2020/11/17 7:23 下午
 */
@RestController
@Api(tags = "管理端,微信账单接口")
@RequestMapping("/payment/wechatBill")
public class WechatBillManagerController {

    @Autowired
    private WechatBillService wechatBillService;


    @ApiOperation(value = "通过id获取微信账单接口")
    @ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path")
    @GetMapping(value = "/get/{id}")
    public ResultMessage<WechatBill> get(@PathVariable @NotNull String id) {
        return ResultUtil.data(wechatBillService.getWechatBill(id));
    }

    @GetMapping
    @ApiOperation(value = "获取微信账单接口分页")
    public ResultMessage<Page<WechatBill>> getByPage(WechatBillSearchParams wechatBillSearchParams) {
        return ResultUtil.data(wechatBillService.wechatBillPage(wechatBillSearchParams));
    }
}
